package ar.com.ctrln.view.menu.compras;

import java.util.LinkedList;
import java.util.List;

import org.zkoss.zk.ui.Component;
import org.zkoss.zk.ui.Executions;
import org.zkoss.zk.ui.select.annotation.Listen;
import org.zkoss.zk.ui.util.GenericForwardComposer;
import org.zkoss.zul.Toolbar;
import org.zkoss.zul.Window;

public class MenuComposerCompras extends GenericForwardComposer<Component> {

	
	private static final long serialVersionUID = 4361030587150372093L;
	Window wDashboard;
	Window wRegistrarCompra;
	Window wConsultarCompra;
	Window wRegistrarPedido;
	Window wConsultarPedido;
	Window wRegistrarProveedor;
	Window wConsultarProveedor;
	Window wRegistrarInsumo;
	Window wConsultarInsumo;
	
	Component registrarWindow = null;
	
	Toolbar toolbar;
	List<Component> heap = new LinkedList<Component>();
	
	
	@Override
	public void doAfterCompose(Component comp) throws Exception {
		super.doAfterCompose(comp);
		Component window = Executions.createComponents(
				"/zul/compras/dashboard.zul", wDashboard, null);
		heap.add(window);
		
	}

public void onClick$bRegistrarCompra$wMenu$iMenu() {
	if(wRegistrarCompra!=null){
		wRegistrarCompra.detach();
	}		
	wRegistrarCompra = (Window)Executions.createComponents("/zul/compras/compras/registrarCompra.zul", wDashboard, null);
	heap.add(wRegistrarCompra);
}

public void onClick$bConsultarCompra$wMenu$iMenu() {
	if(wConsultarCompra!=null){
		wConsultarCompra.detach();
	}		
	wConsultarCompra = (Window)Executions.createComponents("/zul/compras/compras/consultarCompras.zul", wDashboard, null);
	heap.add(wConsultarCompra);
}

public void onClick$bRegistrarPedidoCompra$wMenu$iMenu() {
	if(wRegistrarPedido!=null){
		wRegistrarPedido.detach();
	}		
	wRegistrarPedido = (Window)Executions.createComponents("/zul/compras/registrarNotaPedido.zul", wDashboard, null);
	heap.add(wRegistrarPedido);
}

public void onClick$bConsultarPedidoCompra$wMenu$iMenu() {
	if(wConsultarPedido!=null){
		wConsultarPedido.detach();
	}		
	wConsultarPedido = (Window)Executions.createComponents("/zul/compras/consultarNotaPedido.zul", wDashboard, null);
	heap.add(wConsultarPedido);
}

public void onClick$bRegistrarProveedor$wMenu$iMenu()  {
	if(wRegistrarProveedor!=null){
		wRegistrarProveedor.detach();
	}		
	Component wRegistrarProveedor = Executions.createComponents("/zul/compras/proveedor/registrarProveedor.zul", wDashboard, null);
	heap.add(wRegistrarProveedor);
}

public void onClick$bConsultarProveedor$wMenu$iMenu() {
	if(wConsultarProveedor!=null){
		wConsultarProveedor.detach();
	}		
	wConsultarProveedor = (Window)Executions.createComponents("/zul/compras/proveedor/consultarProveedor.zul", wDashboard, null);
	heap.add(wConsultarProveedor);
}

public void onClick$bRegistrarInsumo$wMenu$iMenu() {

	if(wRegistrarInsumo!=null){
		wRegistrarInsumo.detach();
	}		
	wRegistrarInsumo = (Window)Executions.createComponents("/zul/compras/insumos/registrarInsumo.zul",wDashboard, null);
	 heap.add(wRegistrarInsumo);
	
}

public void onClick$bConsultarInsumo$wMenu$iMenu(){
	
	if(wConsultarInsumo!=null){
		wConsultarInsumo.detach();
	}		
	wConsultarInsumo = (Window)Executions.createComponents("/zul/compras/insumos/consultarInsumo.zul", wDashboard, null);
	heap.add(wConsultarInsumo);
	
}
	
}
